package com.meida.paotui.bus.provider.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import com.meida.common.mybatis.model.*;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import org.springframework.web.bind.annotation.RestController;
import com.meida.common.springmvc.base.BaseController;
import com.meida.paotui.bus.client.entity.BusCustomer;
import com.meida.paotui.bus.provider.service.BusCustomerService;


/**
 * 控制器
 *
 * @author flyme
 * @date 2019-12-06
 */
@RestController
@RequestMapping("/bus/customer/")
public class BusCustomerController extends BaseController<BusCustomerService, BusCustomer>  {

    @ApiOperation(value = "-分页列表", notes = "分页列表 <a href=\"#\" target='_blank'>参数说明</a>")
    @GetMapping(value = "page")
    public ResultBody pageList(@RequestParam(required = false) Map map) {
        return bizService.pageList(map);
    }

    @ApiOperation(value = "-列表", notes = "列表 <a href=\"#\" target='_blank'>参数说明</a>")
    @GetMapping(value = "list")
    public ResultBody list(@ModelAttribute(value = "listModel") ListModel listModel) {
        return bizService.listEntityMap(listModel);
    }

    @ApiOperation(value = "-添加", notes = "添加")
    @PostMapping(value = "save")
    public ResultBody save(@RequestParam(required = false) Map params) {
        return bizService.add(params);
    }

    @ApiOperation(value = "-更新", notes = "更新")
    @PostMapping(value = "update")
    public ResultBody update(@RequestParam(required = false) Map params) {
        return bizService.edit(params);
    }

    @ApiOperation(value = "-删除", notes = "删除")
    @PostMapping(value = "delete")
    public ResultBody delete(@RequestParam(required = false) Map params) {
        return bizService.delete(params);
    }


    @ApiOperation(value = "-详情", notes = "详情")
    @GetMapping(value = "get")
    public ResultBody get(@ModelAttribute(value = "getModel") GetModel getModel) {
        return bizService.get(getModel);
    }

    @ApiOperation(value = "-更新状态值", notes = "更新某个状态字段")
    @PostMapping(value = "setState")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", required = true, value = "主键", paramType = "form"),
            @ApiImplicitParam(name = "state", required = true, value = "状态值", paramType = "form")
    })
    public ResultBody setState(@RequestParam(required = false) Map map, @RequestParam(value = "state") Integer state) {
            return bizService.setState(map, "state", state);
    }
}
